<#assign fieldReadonly = true>

<#-- 只有未递交财务，且可编辑时，fieldReadonly属性设为false-->
<#if currMonthSchedule??>
	<#if currMonthSchedule.locked?default("0")=="0">
		<#if !formField.readonly?? || formField.readonly=="0">
			<#assign fieldReadonly = false>
		</#if>
	</#if>
<#else>
	<#if !formField.readonly?? || formField.readonly=="0">
		<#assign fieldReadonly = false>
	</#if>
</#if>

<#-- 定义宏，输出月度费用表单-->
<#macro renderMonthSchedule fileList readonly=false>
	<#assign feeSuffix = "下月用款申请">
	<#assign feeProperty = "budgetCost">
	<#assign sumLabel = "nextSumCostLabel">
	<#assign sumCost = "nextSumCost">
	<#assign tableId = "nextScheduleTable">
	
	<table id="${tableId}" cellspacing="0" width="100%" border="0" cellpadding="0">
		<tr class="listviewHeader">
			<td colspan="6" align="left">
				${nextYear?c}年${nextMonth}月用款申请
				<#if currMonthSchedule?? && currMonthSchedule.locked?default("0")=="1">
					<font style="color:red; font-weight:normal">（用款申请已报公司财务部门，${nextYear?c}年${nextMonth}月用款申请已停止填报。）</font>
				</#if>
			</td>
		</tr>
		<tr class="listviewTR">
			<#if isVirtualProject?? && isVirtualProject == "0" >
		
			<td width="8%" class="listviewTD" align="right">前期协调费</td>
			<td width="25%" colspan="1" class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".manageCost")?eval??>${("currMonthSchedule."+feeProperty+".manageCost")?eval?c}</#if>
				<#else>
					<input datarule="number" datarulejson='{"displayName":"前期协调费${feeSuffix}","precision":"6","length":"8"}'   type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.manageCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".manageCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".manageCost")?eval?c}"</#if>
					onfocus="$('#manageCostTip').show()" onblur="$('#manageCostTip').hide();showMonthReason(this,$('#manageCostReason'),'<#if availableCost.manageCost??>${availableCost.manageCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="manageCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.manageCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".manageCost")?eval)?? && availableCost?? && availableCost.manageCost?? && (("currMonthSchedule."+feeProperty+".manageCost")?eval) gt availableCost.manageCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="manageCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"前期协调费${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.manageCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".manageCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".manageCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".manageCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".manageCostReason")?eval}</#if>
			</#if>
			</td>
		
		<#else>
			<td width="8%" class="listviewTD" align="right">前期协调费</td>
			<td width="92%" colspan="1" class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".manageCost")?eval??>${("currMonthSchedule."+feeProperty+".manageCost")?eval?c}</#if>
				<#else>
					<input datarule="number" datarulejson='{"displayName":"前期协调费${feeSuffix}","precision":"6","length":"8"}'   type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.manageCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".manageCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".manageCost")?eval?c}"</#if>
					onfocus="$('#manageCostTip').show()" onblur="$('#manageCostTip').hide();showMonthReason(this,$('#manageCostReason'),'<#if availableCost.manageCost??>${availableCost.manageCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="manageCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.manageCost?default('')}万元）</span>
			</td>
			
		</#if>
		</tr>
		
		<#if isVirtualProject?? && isVirtualProject== "0">
		<#if yearfee_type?default('1') != "2">
		<tr class="listviewTR">
			<td width="8%" class="listviewTD" align="right">选址选线</td>
			<td width="25%" class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".locationCost")?eval??>${("currMonthSchedule."+feeProperty+".locationCost")?eval?c}</#if>
				<#else>
					<input  datarule="number"  datarulejson='{"displayName":"选址选线${feeSuffix}","precision":"6","length":"8"}'  type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.locationCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".locationCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".locationCost")?eval?c}"</#if>
					onfocus="$('#locationCostTip').show()" onblur="$('#locationCostTip').hide();showMonthReason(this,$('#locationCostReason'),'<#if availableCost.locationCost??>${availableCost.locationCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="locationCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.locationCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".locationCost")?eval)?? && availableCost?? && availableCost.locationCost?? && (("currMonthSchedule."+feeProperty+".locationCost")?eval) gt availableCost.locationCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="locationCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"选址选线${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.locationCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".locationCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".locationCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".locationCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".locationCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		<tr class="listviewTR">
			<td width="8%" class="listviewTD" align="right">招标代理</td>
			<td width="25%" class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".desginCost")?eval??>${("currMonthSchedule."+feeProperty+".desginCost")?eval?c}</#if>
				<#else>
					<input  datarule="number"  datarulejson='{"displayName":"招标代理${feeSuffix}","precision":"6","length":"8"}' type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.desginCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".desginCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".desginCost")?eval?c}"</#if>
					onfocus="$('#desginCostTip').show()" onblur="$('#desginCostTip').hide();showMonthReason(this,$('#desginCostReason'),'<#if availableCost.desginCost??>${availableCost.desginCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="desginCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.desginCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".desginCost")?eval)?? && availableCost?? && availableCost.desginCost?? && (("currMonthSchedule."+feeProperty+".desginCost")?eval) gt availableCost.desginCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="desginCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"招标代理${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.desginCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".desginCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".desginCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".desginCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".desginCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		</#if>
		<tr class="listviewTR">
			<td class="listviewTD" align="right">可研编制</td>
			<td class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".feasibilityCost")?eval??>${("currMonthSchedule."+feeProperty+".feasibilityCost")?eval?c}</#if>
				<#else>
					<input datarule="number"  datarulejson='{"displayName":"可研${feeSuffix}","precision":"6","length":"8"}'  type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.feasibilityCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".feasibilityCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".feasibilityCost")?eval?c}"</#if>
					onfocus="$('#feasibilityCostTip').show()" onblur="$('#feasibilityCostTip').hide();showMonthReason(this,$('#feasibilityCostReason'),'<#if availableCost.feasibilityCost??>${availableCost.feasibilityCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="feasibilityCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.feasibilityCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".feasibilityCost")?eval)?? && availableCost?? && availableCost.feasibilityCost?? && (("currMonthSchedule."+feeProperty+".feasibilityCost")?eval) gt availableCost.feasibilityCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="feasibilityCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"可研编制${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.feasibilityCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".feasibilityCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".feasibilityCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".feasibilityCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".feasibilityCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		<tr class="listviewTR">
			<td class="listviewTD" align="right">可研评审</td>
			<td class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".feasibilityReviewCost")?eval??>${("currMonthSchedule."+feeProperty+".feasibilityReviewCost")?eval?c}</#if>
				<#else>
					<input datarule="number" datarulejson='{"displayName":"可研评审${feeSuffix}","precision":"6","length":"8"}'  type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.feasibilityReviewCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".feasibilityReviewCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".feasibilityReviewCost")?eval?c}"</#if>
					onfocus="$('#feasibilityReviewCostTip').show()" onblur="$('#feasibilityReviewCostTip').hide();showMonthReason(this,$('#feasibilityReviewCostReason'),'<#if availableCost.feasibilityReviewCost??>${availableCost.feasibilityReviewCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="feasibilityReviewCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.feasibilityReviewCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".feasibilityReviewCost")?eval)?? && availableCost?? && availableCost.feasibilityReviewCost?? && (("currMonthSchedule."+feeProperty+".feasibilityReviewCost")?eval) gt availableCost.feasibilityReviewCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="feasibilityReviewCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"可研评审${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.feasibilityReviewCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".feasibilityReviewCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".feasibilityReviewCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".feasibilityReviewCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".feasibilityReviewCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		<#if yearfee_type?default('1') != "2">
		<tr class="listviewTR">
			<td class="listviewTD" align="right">规划选址评估</td>
			<td class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".planLocationCost")?eval??>${("currMonthSchedule."+feeProperty+".planLocationCost")?eval?c}</#if>
				<#else>
					<input  datarule="number"  datarulejson='{"displayName":"规划选址评估${feeSuffix}","precision":"6","length":"8"}'  type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.planLocationCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".planLocationCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".planLocationCost")?eval?c}"</#if>
					onfocus="$('#planLocationCostTip').show()" onblur="$('#planLocationCostTip').hide();showMonthReason(this,$('#planLocationCostReason'),'<#if availableCost.planLocationCost??>${availableCost.planLocationCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="planLocationCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.planLocationCost?default('')}万元）</span>
			</td>	
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".planLocationCost")?eval)?? && availableCost?? && availableCost.planLocationCost?? && (("currMonthSchedule."+feeProperty+".planLocationCost")?eval) gt availableCost.planLocationCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="planLocationCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"规划选址评估${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.planLocationCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".planLocationCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".planLocationCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".planLocationCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".planLocationCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		</#if>
		<#if yearfee_type?default('1') != "2">
		<tr class="listviewTR">
			<td class="listviewTD" align="right">环评</td>
			<td class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".environmentCost")?eval??>${("currMonthSchedule."+feeProperty+".environmentCost")?eval?c}</#if>
				<#else>
					<input datarule="number" datarulejson='{"displayName":"环评${feeSuffix}","precision":"6","length":"8"}'  type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.environmentCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".environmentCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".environmentCost")?eval?c}"</#if>
					onfocus="$('#environmentCostTip').show()" onblur="$('#environmentCostTip').hide();showMonthReason(this,$('#environmentCostReason'),'<#if availableCost.environmentCost??>${availableCost.environmentCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="environmentCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.environmentCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".environmentCost")?eval)?? && availableCost?? && availableCost.environmentCost?? && (("currMonthSchedule."+feeProperty+".environmentCost")?eval) gt availableCost.environmentCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="environmentCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"环评${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.environmentCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".environmentCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".environmentCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".environmentCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".environmentCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		<tr class="listviewTR">
			<td class="listviewTD" align="right">水保</td>
			<td class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".waterCost")?eval??>${("currMonthSchedule."+feeProperty+".waterCost")?eval?c}</#if>
				<#else>
					<input  datarule="number"  datarulejson='{"displayName":"水保${feeSuffix}","precision":"6","length":"8"}'  type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.waterCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".waterCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".waterCost")?eval?c}"</#if>
					onfocus="$('#waterCostTip').show()" onblur="$('#waterCostTip').hide();showMonthReason(this,$('#waterCostReason'),'<#if availableCost.waterCost??>${availableCost.waterCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="waterCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.waterCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".waterCost")?eval)?? && availableCost?? && availableCost.waterCost?? && (("currMonthSchedule."+feeProperty+".waterCost")?eval) gt availableCost.waterCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="waterCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"水保${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.waterCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".waterCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".waterCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".waterCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".waterCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		<tr class="listviewTR">
			<td class="listviewTD" align="right">土地调规</td>
			<td class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".landCost")?eval??>${("currMonthSchedule."+feeProperty+".landCost")?eval?c}</#if>
				<#else>
					<input  datarule="number"  datarulejson='{"displayName":"土地调规${feeSuffix}","precision":"6","length":"8"}'  type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.landCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".landCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".landCost")?eval?c}"</#if>
					onfocus="$('#landCostTip').show()" onblur="$('#landCostTip').hide();showMonthReason(this,$('#landCostReason'),'<#if availableCost.landCost??>${availableCost.landCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="landCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.landCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".landCost")?eval)?? && availableCost?? && availableCost.landCost?? && (("currMonthSchedule."+feeProperty+".landCost")?eval) gt availableCost.landCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="landCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"土地调规${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.landCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".landCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".landCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".landCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".landCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		<tr class="listviewTR">
			<td class="listviewTD" align="right">节能评估</td>
			<td class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".powerEvalCost")?eval??>${("currMonthSchedule."+feeProperty+".powerEvalCost")?eval?c}</#if>
				<#else>
					<input  datarule="number"  datarulejson='{"displayName":"节能评估${feeSuffix}","precision":"6","length":"8"}'  type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.powerEvalCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".powerEvalCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".powerEvalCost")?eval?c}"</#if>
					onfocus="$('#powerEvalCostTip').show()" onblur="$('#powerEvalCostTip').hide();showMonthReason(this,$('#powerEvalCostReason'),'<#if availableCost.powerEvalCost??>${availableCost.powerEvalCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="powerEvalCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.powerEvalCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".powerEvalCost")?eval)?? && availableCost?? && availableCost.powerEvalCost?? && (("currMonthSchedule."+feeProperty+".powerEvalCost")?eval) gt availableCost.powerEvalCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="powerEvalCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"节能评估${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.powerEvalCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".powerEvalCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".powerEvalCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".powerEvalCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".powerEvalCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		<tr class="listviewTR">
			<td class="listviewTD" align="right">其他</td>
			<td class="listviewContent">
				<#if readonly>
					<#if currMonthSchedule?? && ("currMonthSchedule."+feeProperty)?eval?? && ("currMonthSchedule."+feeProperty+".otherCost")?eval??>${("currMonthSchedule."+feeProperty+".otherCost")?eval?c}</#if>
				<#else>
					<input  datarule="number"  datarulejson='{"displayName":"其他${feeSuffix}","precision":"6","length":"8"}'   type="text" class="text" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.otherCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".otherCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".otherCost")?eval?c}"</#if>
					onfocus="$('#otherCostTip').show()" onblur="$('#otherCostTip').hide();showMonthReason(this,$('#otherCostReason'),'<#if availableCost.otherCost??>${availableCost.otherCost}</#if>');">
				</#if>
				&nbsp;&nbsp;万元<span id="otherCostTip" class="gray_font_12px" style="display:none">（可用额度：${availableCost.otherCost?default('')}万元）</span>
			</td>
			<td width="8%" class="listviewTD" align="right">超支原因</td>
			<td width="58%" class="listviewContent" colspan="3" >
			<#if !formField.readonly?? || formField.readonly=="0">
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".otherCost")?eval)?? && availableCost?? && availableCost.otherCost?? && (("currMonthSchedule."+feeProperty+".otherCost")?eval) gt availableCost.otherCost>
					<#assign showReason="1">
				<#else>
					<#assign showReason="0">
				</#if>
				<textarea <#if showReason?? && showReason=="0">disabled="disabled"</#if> id="otherCostReason" datarule="string" style="width:99%" rows="2" datarulejson='{"dataType":"string","isRequired":"1","description":"字符串长度小于等于2000字符","length":"2000","displayName":"其他${feeSuffix}超支原因"}' onblur="this.value=this.value.trim()" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.otherCostReason"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".otherCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".otherCostReason")?eval}</#if></textarea>
			<#else>
				<#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".otherCostReason")?eval)??>${("currMonthSchedule."+feeProperty+".otherCostReason")?eval}</#if>
			</#if>
			</td>
		</tr>
		</#if>
		
		<tr class="listviewTR">
			<td class="listviewTD" align="right">合计</td>
			<td class="listviewContent" colspan="5">
				<label id="${sumLabel}"><#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".sumCost")?eval)??>${("currMonthSchedule."+feeProperty+".sumCost")?eval}<#else>0</#if></label>
				&nbsp;&nbsp;万元
				<#if !readonly>
					<input id="${sumCost}" type="hidden" name="fieldMap['${field.name}'].monthSchedule.${feeProperty}.sumCost" <#if currMonthSchedule?? && (("currMonthSchedule."+feeProperty)?eval)?? && (("currMonthSchedule."+feeProperty+".sumCost")?eval)??>value="${("currMonthSchedule."+feeProperty+".sumCost")?eval?c}"</#if>>
				</#if>
			</td>
		</tr>
		</#if>
		<tr class="listviewTR">
			<td class="listviewTD" align="right">财务预算文件</td>
			<td class="listviewContent" colspan="5">
				<@renderAttachment fileList=fileList readonly=readonly/>
			</td>
		</tr>
	</table>
</#macro>

<#-- 定义宏，输出附件区域 -->
<#macro renderAttachment fileList readonly=false>

<#assign filePanelPrefix = "nextFileInfo">
<#assign scheduleProperty = "monthSchedule">
<#assign uploadifyId = "uploadifyNext">

<table cellspacing="0" cellpadding="0" width="100%">
	<#if fileList?? && (fileList?size?default(0) > 0)>
	<#assign index = 1>
	<tr class="listviewTR">
		<td width="85%" colSpan=6 style="line-height:20px">
			<#list fileList as fileInfo>
				<div id="${filePanelPrefix}${field.name}${fileInfo.fileId}">
					<input type=hidden name="fieldMap['${field.name}'].${scheduleProperty}.oldFileQueue[${index}].fileId" value="${fileInfo.fileId}">
					<div style="position:relative;+position:static;_position:static;float:left;clear:left">
						<span class="fileName">
							<div style="width:650px">
								<div style="position:relative;+position:static;_position:static;clear:left;float:left;padding:2px;clear:left;width:20px">
									<img border="0" src="/PNPMS/script/plugins/Uploadify/global.jpg" class="statusimg">
								</div>
								<div style="position:relative;+position:static;_position:static;float:left;width:500px">
									&nbsp;[${fileInfo.dateTime?string('yyyy-MM-dd')}]&nbsp;&nbsp;<a href="javascript:void(0);" onclick="downloadAttachment${field.name?replace('.','_')}('${fileInfo.fileId}');return false;"><#if fileInfo.realName?? && fileInfo.aliasName??><span title="${fileInfo.realName}">${fileInfo.aliasName}</span><#else>${fileInfo.realName}</#if></a>
									<#if fileInfo.ext?? && (fileInfo.ext=='doc' || fileInfo.ext=='DOC' || fileInfo.ext=='docx' || fileInfo.ext=='DOCX' || fileInfo.ext=='xls' || fileInfo.ext=='XLS' || fileInfo.ext=='xlsx' || fileInfo.ext=='XLSX' || fileInfo.ext=='pdf' || fileInfo.ext=='PDF' || fileInfo.ext=='jpg' || fileInfo.ext=='JPG' || fileInfo.ext=='jpeg' || fileInfo.ext=='JPEG' || fileInfo.ext=='bmp' || fileInfo.ext=='BMP' || fileInfo.ext=='png' || fileInfo.ext=='PNG' || fileInfo.ext=='gif' || fileInfo.ext=='GIF' || fileInfo.ext=='tif' || fileInfo.ext=='TIF' || fileInfo.ext=='ppt' || fileInfo.ext=='PPT' || fileInfo.ext=='pptx' || fileInfo.ext=='PPTX')>
									&nbsp;<a href="javascript:void(0);" onclick="viewAttachment${field.name?replace('.','_')}('${fileInfo.fileId}');return false;">预览</a>
									</#if>
								</div>
								<div style="position:relative;+position:static;_position:static;float:left;width:20px" class="cancel">
									<#if !fieldReadonly>
									<a href="javascript:void(0);" onclick="javascript:deleteAttachment('${filePanelPrefix}${field.name}', '${fileInfo.fileId}');"><img border="0" src="/PNPMS/theme/default/images/main/delete.png"/></a>
									</#if>
								</div>
							</div>
						</span>
					</div>
				</div>
				<#assign index = index+1>
			</#list>
		</td>
	</tr>
	</#if>
	<#if !readonly>
	<tr class="listviewTR">
		<td colspan=6>
			<div id="fieldMap['${field.name}'].${scheduleProperty}.fileQueue" style="text-align: left;">
				<#assign index=1>
				<#if businessInstanceField?? && (("businessInstanceField." + scheduleProperty)?eval)?? && (("businessInstanceField." + scheduleProperty + ".fileQueue")?eval)??>
					<#list ("businessInstanceField." + scheduleProperty + ".fileQueue")?eval as fileInfo>
						<#if fileInfo?? && fileInfo.realName??>
						<div id="uploadify${field.name}newfile${index}" class="uploadifyQueueItem completed" style="width:650px">
							<div style="width:520px;clear:left;float:left">
								<span class="fileName">
								<img class="statusimg" border="0" src="/PNPMS/script/plugins/Uploadify/global.jpg">
								&nbsp;${fileInfo.realName}(${fileInfo.fileSize})
								</span>
								<span class="percentage"></span>
							</div>
							<div class="cancel" style="padding:2px;float:left;width:20px">
								<a href="javascript:jQuery('#uploadify${field.name}').uploadifyCancel('newfile${index}')">
								<img border="0" src="/PNPMS/theme/default/images/main/delete.png">
								</a>
							</div>
							<input id="uploadify${field.name}newfile${index}hidvalue" type="hidden" value='{"aliasName":null,"company":null,"dateTime":null,"ext":null,"fileData":null,"fileId":null,"fileType":null,"length":0,"node":null,"fileSize":"${fileInfo.fileSize}","realName":"${fileInfo.realName}","realPath":"${fileInfo.realPath?replace('\\','/')}"}' name="fieldMap['${field.name}'].${scheduleProperty}.fileQueue">
						</div>
						<#assign index=index + 1>
						</#if>
					</#list>
				</#if>
			</div>
			<div style="clear:both"><input type="file" name="uploadify${field.name}" id="${uploadifyId}${field.name?replace('.','_')}" />
			<script>
			$(document.getElementById('${uploadifyId}${field.name?replace('.','_')}')).uploadify({
			    'basepath'  : TDQS.CONTEXT_PATH,
			    'queueID'   : "fieldMap['${field.name}'].${scheduleProperty}.fileQueue",
			    'fileDesc' 	: '请选择财务预算文件',
			    'sizeLimit' : 1024*1024*100,
			    'fileExt' 	: '*.doc;*.docx;*.xls;*.xlsx;*.pdf;*.zip;*.rar;*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.DWG;*.psd;*.dws;*.dxf;*.dwt;*.ppt;*.pptx;*.mmp;*.vsd;*.tif'
			    ,
			    'onSelect' : function(){
	            	$('.button','.buttonBox').attr('disabled','disabled');
	            },
	            'onCancel' : function(){
	            	$('.button','.buttonBox').attr('disabled',false);
	            },
            	'onComplete' : function(event, ID, fileObj, response, data){
	            	$('.button','.buttonBox').attr('disabled',false);
	            },
	            'onError' : function(){
            		$('.button','.buttonBox').attr('disabled',false);
	            },
	            'onFileSizeError' : function(){
	            	$('.button','.buttonBox').attr('disabled',false);
	            }
			});
			</script>
		</td>
	</tr>
	</#if>	
</table>
</#macro>

<#-- 定义宏，输出历史费用列表 -->
<#macro renderList>

<#assign historyFeeProperty = "budgetCost">

<table cellspacing="1" width="100%" border="0" cellpadding="0" class="listviewTable">
	<tr class="listviewHeader">
		<td class="listviewTD" align="center">月份</td>
		<td class="listviewTD" align="center">前期协调费</td>
		
		<#if  isVirtualProject?? && isVirtualProject== "0">
		<#if yearfee_type?default('1') != "2">
		<td class="listviewTD" align="center">选址选线</td>
		<td class="listviewTD" align="center">招标代理</td>
		</#if>
		
		<td class="listviewTD" align="center">可研编制</td>
		<td class="listviewTD" align="center">可研评审</td>
		
		<#if yearfee_type?default('1') != "2">
		<td class="listviewTD" align="center">环评</td>
		<td class="listviewTD" align="center">水保</td>
		<td class="listviewTD" align="center">选址评估</td>
		<td class="listviewTD" align="center">土地调规</td>
		<td class="listviewTD" align="center">节能评估</td>
		<td class="listviewTD" align="center">其他</td>
		</#if>
		
		<td class="listviewTD" align="center">合计</td>
		</#if>
	</tr>
	<#list monthsche_list as monthsche>
	<#if monthsche?? && monthsche.budgetCost?? && monthsche.budgetCost.sumCost gt 0>
	<tr>
		<td class="listviewContent" align="center">${monthsche.year?c}年${monthsche.month}月</td>
		<td class="listviewContent" align="center"><#if monthsche.budgetCost.manageCost??>${monthsche.budgetCost.manageCost?c}</#if></td>
		
		<#if  isVirtualProject?? && isVirtualProject== "0">
		<#if yearfee_type?default('1') != "2">
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.locationCost)??>${monthsche.budgetCost.locationCost?c}</#if>&nbsp;</td>
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.desginCost)??>${monthsche.budgetCost.desginCost?c}</#if>&nbsp;</td>
		</#if>
		
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.feasibilityCost)??>${monthsche.budgetCost.feasibilityCost?c}</#if>&nbsp;</td>
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.feasibilityReviewCost)??>${monthsche.budgetCost.feasibilityReviewCost?c}</#if>&nbsp;</td>
		
		<#if yearfee_type?default('1') != "2">
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.environmentCost)??>${monthsche.budgetCost.environmentCost?c}</#if>&nbsp;</td>
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.waterCost)??>${monthsche.budgetCost.waterCost?c}</#if>&nbsp;</td>
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.planLocationCost)??>${monthsche.budgetCost.planLocationCost?c}</#if>&nbsp;</td>
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.landCost)??>${monthsche.budgetCost.landCost?c}</#if>&nbsp;</td>
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.powerEvalCost)??>${monthsche.budgetCost.powerEvalCost?c}</#if>&nbsp;</td>
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.otherCost)??>${monthsche.budgetCost.otherCost?c}</#if>&nbsp;</td>
		</#if>
		</#if>
		<td class="listviewContent" align="center"><#if (monthsche.budgetCost.sumCost)??>${monthsche.budgetCost.sumCost?c}</#if>&nbsp;</td>
	</tr>
	</#if>
	</#list>
</table>
</#macro>

<#if !fieldReadonly>
<input type=hidden name="fieldMap['${field.name}'].field.id"  value="${formField.field.id}">
<input type="hidden" name="fieldMap['${field.name}'].entityId" <#if currMonthSchedule?? && currMonthSchedule.id??>value="${currMonthSchedule.id}"</#if>>
<input type="hidden" name="fieldMap['${field.name}'].monthSchedule.id" <#if currMonthSchedule?? && currMonthSchedule.id?? >value="${currMonthSchedule.id}"</#if>>
<input type="hidden" name="fieldMap['${field.name}'].monthSchedule.budgetCost.id" <#if currMonthSchedule?? && currMonthSchedule.budgetCost?? && currMonthSchedule.budgetCost.id??>value="${currMonthSchedule.budgetCost.id}"</#if>>
</#if>

<table cellspacing="0" width="100%" border="0" cellpadding="0" >
	<#if !fieldReadonly>
		<tr>
			<td>
				<@renderMonthSchedule fileList=fileinfo_list readonly=false/>
			</td>
		</tr>
	<#else>
		<tr>
			<td>
				<@renderMonthSchedule fileList=fileinfo_list readonly=true/>
			</td>
		</tr>
	</#if>
	<tr>
		<td>
		<table id="historyScheduleTable" cellspacing="0" width="100%" border="0" cellpadding="0" class="listviewTable">
			<tr class="listviewHeader">
				<td>
					<div id="showMonthSpan" onclick="showMonthHistoryList();return false;" class="tableOpen"></div><div style="float:left;line-height:17px;">&nbsp;费用申请记录（单位：万元）</div>
				</td>
			</tr>
			<tr id="monthHistoryList">
				<td>			
					<@renderList/>
				</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<script>
function downloadAttachment${field.name?replace('.','_')}(attachmentId) {
	var url = TDQS.CONTEXT_PATH+"/download/downLoadAttachment?attachmentId="+attachmentId+"&date="+new Date().toLocaleString();
  	var frame = document.createElement("iframe");
	frame.src = url;
	frame.style.display = "none";
	document.body.appendChild(frame);
}
function viewAttachment${field.name?replace('.','_')}(attachmentId) {
	var url = TDQS.CONTEXT_PATH+"/download/viewAttachment?attachmentId="+attachmentId+"&instanceId=<#if businessInstanceField?? && businessInstanceField.instance?? && businessInstanceField.instance.id??>${businessInstanceField.instance.id}</#if>&date="+new Date().toLocaleString();
    window.open(url);
}

function deleteAttachment(element, index) {
  	jConfirm('确认要删除附件吗？', '确认对话框 ', function(r) {
		if(r){
			$(document.getElementById(element+index)).remove();
		}else{
			return false;
		}
	});
}
function showMonthReason(cost,reason,availCost){
	if(availCost!='' && cost.value!='' && new Number(cost.value)>new Number(availCost)) {
		reason.attr('disabled',false);
	} else {
		reason.attr('disabled',true);
		reason.text('');
	}
	validator.form();
}

function showMonthHistoryList() {
	if($('#showMonthSpan').hasClass("tableOpen")) {
		$('#monthHistoryList').hide();
		$('#showMonthSpan').removeClass("tableOpen");
		$('#showMonthSpan').addClass("tableClose");
	} else {
		$('#monthHistoryList').show();
		$('#showMonthSpan').removeClass("tableClose");
		$('#showMonthSpan').addClass("tableOpen");
	}
}
function nextSumCostResult() {
	var sum = new Number(0);
	
	$('input','#nextScheduleTable').each(function(){
		if($(this).val()!='' && $(this).attr('id')!='nextSumCost') {
			try{
				var cost = new Number($(this).val());
				if(cost && cost+''!='NaN' && cost!=null) {
					sum  = floatAdd(sum,cost);
					$('#nextSumCost').val(sum);
					if($('#nextSumCostLabel').html()=='') {
						if(sum!=0) {
							$('#nextSumCostLabel').html(sum);
							$('#nextSumCost').val(sum);
						}
					} else {
						$('#nextSumCostLabel').html(sum);
						$('#nextSumCost').val(sum);
					}
				}
			}catch(e){}
		}
	});
}

function historyMothLayout(){
	$("#nextScheList").css("width",window.document.body.clientWidth-36);
}

$(document).ready(function(){
	<#if !fieldReadonly>
		$('input','#nextScheduleTable').blur(function(){
			nextSumCostResult();
		});
	</#if>
	
	historyMothLayout();
	
	$(window).resize(historyMothLayout);
});
</script>